As a technology for capturing a clear image in focus, an autofocus technology has been known in which the focus is automatically set on a prescribed position. As procedures of the autofocus technology, various procedures such as a retardation procedure and a contrast procedure have been known. Recently, an autofocus of the contrast procedure is installed in compact digital cameras and many cameras installed in cellular phones. In the contrast procedure, a position where a high frequency component of a picture cast on an image capturing element is high (high contrast) is searched for while a focus lens is moved, and the focus is thereby set. The focal position may be decided by calculating the high frequency component around a center of the picture, the focal position may be decided by calculating the high frequency components in whole the picture, the focal position may be decided by calculating the high frequency component of an object that is selected on a touch panel by an operator, and so forth. The autofocus allows the operator (photographer) him/herself not to have to adjust the focus and enables a clear image in focus to be captured by a simpler operation.
However, in a case where plural objects are present in different distances and the focus is set on one of the objects by the autofocus, the focus may not be set on the other object in the different distance.
Accordingly, there has been developed a technology for obtaining a clear image in which all plural objects are in focus in a case where the plural objects whose images the operator desires to capture are present and the objects are in positions in different distances. For example, PTL 1 mentioned below discloses that plural images are successively captured in different focal positions, the images of the plural objects that are common to the images are extracted from the respective clearest captured images and synthesized, and an image in which all the plural objects are clear is thereby obtained.